package com.ynny.dao;

import com.ynny.bean.Selectt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class SelecttDaoImpl implements SelecttDao{
   @Autowired

    JdbcTemplate jdbcTemplate;
    @Override
    public Selectt getSelect(String number) {
        String sql = "select * from selectt where number = ?";
        Selectt select = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Selectt.class), number);
        return select;


    }

    @Override
    public int insertSelect(String number, Integer moive, Integer AD, Integer PR) {
        String sql = "insert into selectt(number,moive,AD,PR) values(?,?,?,?)";
        int i = jdbcTemplate.update(sql, number, moive, AD, PR);
        return i;




    }
}
